import request, { ListReponse } from "../utils/request";

export function fetchList(params) {
  return request({
    url: "/RoomPatrolTask/v1/list",
    method: "get",
    params,
  });
}

export function createTask(data) {
  return request({
    url: "/RoomPatrolTask/v1/deviceTask",
    method: "post",
    data,
  });
}

export function fetchMapList(params) {
  return request<any, ListReponse<any>>({
    url: "/robot-map/v1/list",
    method: "get",
    params,
  });
}

export function deleteTask(id) {
  return request({
    url: `/RoomPatrolTask/v1/${id}`,
    method: "delete",
  });
}

export function updateTask(data) {
  return request({
    url: `/RoomPatrolTask/v1/update`,
    method: "put",
    data,
  });
}

export function activeTask(id) {
  return request({
    url: `/RoomPatrolTask/v1/activation/${id}`,
    method: "get",
  });
}

export function controlTask(data) {
  return request({
    url: "/RoomPatrolTask/control",
    method: "post",
    data,
  });
}

export function fetchDeviceList(mid) {
  return request({
    url: `/deviceProfile/v1/getDeviceByMid/${mid}`,
    method: "get",
  });
}
